#include "vector3.h"


vector3::vector3(){}
vector3::vector3(float x,float y,float z)
{
	this->x=x;
	this->y=y;
	this->z=z;
}
vector3::vector3(vec4 v)
{
	if(v.w==1)
		throw std::logic_error("Cannot convert a point to vector.");
	this->x=v.x;
	this->y=v.y;
	this->z=v.z;
}

/////<summary>become unit vector</summary>
//void normalize()
//{
//	float d=sqrt( x*x+y*y+z*z);
//	x/=d;
//	y/=d;
//	z/=d;
//}

//float dotProduct(const vec4& v)
//{
//	return x*v.x+y*v.y+z*v.z;
//}

vector3::operator vec4() const
{
	return vec4(this->x,this->y,this->z,0);
}